package tgc.edu.zz.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import tgc.edu.zz.service.LogService;
import tgc.edu.zz.utils.AjaxResult;
import tgc.edu.zz.utils.TablePageable;
import tgc.edu.zz.vo.LoginLogVo;

@Controller
@RequestMapping("/log")
public class LogController {

	@Autowired
	private LogService logService;
	
	/**
	 * @return 登录日志页面
	 */
	@RequestMapping("/log")
	public String log() {
		return "log/log";
	}
	/**
	 * @param form
	 * @param pageParam
	 * @return 显示登录日志所有记录（bootstrap表格显示）
	 */
	@RequestMapping("/list")
	@ResponseBody
	public Object list(LoginLogVo form,TablePageable pageParam) {
		PageRequest pageable = pageParam.bulidPageRequest();
		Specification<LoginLogVo> spec = buildSpec(form);
		Page<LoginLogVo> page= logService.findAll(spec, pageable);
		return AjaxResult.bulidPageResult(page);
		
	}

	private Specification<LoginLogVo> buildSpec(LoginLogVo form) {
		return null;
	}
}
